import '@/css/message.scss';

function initEl(callBack, id) {
  let el = document.getElementById('0ecf1e9e')
  if (el) {
    return el
  }
  el = document.createElement('div')
  callBack(el)
  el.id = id
  document.body.append(el)
  el.addEventListener('animationend', () => {
    el.classList.remove('Animatee0cf1e9e')
  })
  return el
}
const alterEl = initEl(el => {
  el.innerHTML = `
  <svg style="margin-right: 4px;" t="1513590447537" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9504" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16">
   <path d="M512 0C228.8 0 0 228.8 0 512s228.8 512 512 512 512-228.8 512-512S795.2 0 512 0z m0 832c-35.2 0-64-28.8-64-64s28.8-64 64-64 64 28.8 64 64-28.8 64-64 64z m64-320c0 35.2-28.8 64-64 64s-64-28.8-64-64V256c0-35.2 28.8-64 64-64s64 28.8 64 64v256z" p-id="9505" fill="#666">
   </path>
  </svg>
  `
  const span = document.createElement('span')
  el.append(span)
}, 'e0cf1e9e')
let alertTimeId
export const alert = function (v) {
  alterEl.querySelector('span').innerHTML = v
  if(alterEl.classList.contains('Animatee0cf1e9e')) {
    alterEl.classList.remove('Animatee0cf1e9e')
    window.getComputedStyle(alterEl).display
  }
   alterEl.classList.add('Animatee0cf1e9e')
}